package com.huitone.gddw.service.impl.system.timer;

import java.util.TimerTask;

import com.huitone.gddw.dao.entity.Users;
import com.huitone.gddw.service.system.IUsersService;

public class TimerTaskUsers extends TimerTask {
	
	private Users user;
	
	private IUsersService usersService;
	
	public TimerTaskUsers(IUsersService usersService, Users entity) {
		this.usersService = usersService;
		this.user = entity;
	}

	@Override
	public void run() {
		unlockUser(user);
	}
	
	private void unlockUser(Users entity) {
		entity.setFailCount(0);
		entity.setLockStatus(Users.LOCK_STATUS_NORMAL);
		entity.setFreezeDate(null);
		usersService.update(entity);
	}
	
}
